package com.zlj.web.listener;

import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;

/**
 * 感知监听器 ：HttpSessionBindingListener
 * 
 * HttpSessionBindingListener：添加到JavaBean上，JavaBean就知道自己是否添加到session中了。
 * 
 * @author bashen
 *
 */
public class User implements HttpSessionBindingListener{
	
	private String name;
	private String password;

	public User() {
		super();
	}

	public User(String name, String password) {
		super();
		this.name = name;
		this.password = password;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getPassword() {
		return password;
	}
	
	public void setPassword(String password) {
		this.password = password;
	}
	
	@Override
	public String toString() {
		return "User [name=" + name + ", password=" + password + "]";
	}

	@Override
	public void valueBound(HttpSessionBindingEvent hsbe) {
		System.out.println("啊。。。。。。Session添加了我！");
	}

	@Override
	public void valueUnbound(HttpSessionBindingEvent hsbe) {
		System.out.println("无情的session移除了我！！！！！！！！！！！！！！");
	}
}
